package com.smallkingson.ylib.core.utils;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by yorun on 2017/1/11.
 */

public class YReflects {
    public static Map<Class,Method[]> declaredMethodsCache=new HashMap<>();
    public static Map<Class,Method[]> methodsCache=new HashMap<>();

    private Method[] getDeclaredMethods(Class<?> aClass) {
        Method[] declaredMethods=declaredMethodsCache.get(aClass);
        if (declaredMethods==null) {
            declaredMethods= aClass.getDeclaredMethods();
            declaredMethodsCache.put(aClass, declaredMethods);
        }
        return declaredMethods;
    }
    private Method[] getMethods(Class<?> aClass) {
        Method[] methods=methodsCache.get(aClass);
        if (methods==null) {
            methods= aClass.getDeclaredMethods();
            methodsCache.put(aClass, methods);
        }
        return methods;
    }
}
